﻿@model WebApp.Models.STOCK
@{
        /**/

        /**/

        ViewBag.Title = "入库检验";
}
<!-- MAIN CONTENT -->
<div id="content">
  <!-- quick navigation bar -->
  <div class="row">
    <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
      <h1 class="page-title txt-color-blueDark">
        <i class="fa fa-table fa-fw "></i>
        库存作业
        <span>
          >
          入库检验
        </span>
      </h1>
    </div>
    <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8">

    </div>
  </div>
  <!-- end quick navigation bar -->
  <!-- widget grid -->
  <section id="widget-grid" class="">
    <!-- row -->
    <div class="row">
      <!-- NEW WIDGET START -->
      <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <!-- Widget ID (each widget will need unique ID)-->
        <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false" data-widget-deletebutton="false">
          <!-- widget options:
          usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
          data-widget-colorbutton="false"
          data-widget-editbutton="false"
          data-widget-togglebutton="false"
          data-widget-deletebutton="false"
          data-widget-fullscreenbutton="false"
          data-widget-custombutton="false"
          data-widget-collapsed="true"
          data-widget-sortable="false"
          -->
          <header>
            <span class="widget-icon"> <i class="fa fa-table"></i> </span>
            <h2>库存管理</h2>
          </header>

          <!-- widget div-->
          <div>
            <!-- widget edit box -->
            <div class="jarviswidget-editbox">
              <!-- This area used as dropdown edit box -->
            </div>
            <!-- end widget edit box -->
            <!-- widget content -->
            <div class="widget-body no-padding">
              <div class="sk-spinner sk-spinner-wave">
                <div class="sk-rect1"></div>
                <div class="sk-rect2"></div>
                <div class="sk-rect3"></div>
                <div class="sk-rect4"></div>
                <div class="sk-rect5"></div>
              </div>
              <div class="widget-body-toolbar">
                <div class="row">
                  <form id="query_form"
                        class="easyui-form form-horizontal">
                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label">供应商</label>
                      <div class="col-md-9">
                        <input id="SUPPLIERCODE"
                               name="SUPPLIERCODE"
                               value=""
                               tabindex="5"
                               class="easyui-combogrid"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'供应商',
                               panelHeight: 'auto',
        url: '/SUPPLIERs/GetComboData',
        method: 'get',
        idField: 'SUPPLIERCODE',
        panelWidth: 350,
        pagination: true,
        pageSize:10,
        textField: 'SUPPLIERCODE',
        columns: [[
          { field: 'SUPPLIERCODE', title: '供应商代码', width: 110 },
          { field: 'SUPPLIERNAME', title: '供应商名称', width: 220 }
        ]]
												       " />
                      </div>
                    </div>

                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label">收货单订单编号</label>
                      <div class="col-md-9">
                        <input id="@Html.IdFor(model => model.POKEY)"
                               name="@Html.NameFor(model => model.POKEY)"
                               value="@Html.ValueFor(model => model.POKEY)"
                               tabindex="3"
                               class="easyui-textbox"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'@Html.DisplayNameFor(model => model.POKEY)',
								 required:false,
                                 validType: 'length[0,30]'
                                 " />
                      </div>

                    </div>
                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.EXTERNRECEIPTKEY)</label>
                      <div class="col-md-9">
                        <input id="@Html.IdFor(model => model.EXTERNRECEIPTKEY)"
                               name="@Html.NameFor(model => model.EXTERNRECEIPTKEY)"
                               value="@Html.ValueFor(model => model.EXTERNRECEIPTKEY)"
                               tabindex="2"
                               class="easyui-textbox"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'@Html.DisplayNameFor(model => model.EXTERNRECEIPTKEY)',

                                 " />
                      </div>
                    </div>
                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.SKU)</label>
                      <div class="col-md-9">
                        <input id="@Html.IdFor(model => model.SKU)"
                               name="@Html.NameFor(model => model.SKU)"
                               value="@Html.ValueFor(model => model.SKU)"
                               tabindex="10"
                               class="easyui-textbox"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'@Html.DisplayNameFor(model => model.SKU)',

                                 " />
                      </div>
                    </div>
                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label">收货单日期(起)</label>
                      <div class="col-md-9">
                        <input id="RECEIPTDATE1"
                               name="RECEIPTDATE1"
                               value=""
                               tabindex="5"
                               class="easyui-datebox"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'收货单日期(起)',
												 " />
                      </div>
                    </div>
                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label">收货单日期(至)</label>
                      <div class="col-md-9">
                        <input id="RECEIPTDATE2"
                               name="RECEIPTDATE2"
                               value=""
                               tabindex="5"
                               class="easyui-datebox"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'收货单日期(至)',
												 " />
                      </div>
                    </div>
                    <div class="form-group  col-md-3">
                      <label class="col-md-3 control-label"><span class="required">@Html.DisplayNameFor(model => model.STATUS)</span></label>
                      <div class="col-md-9">
                        <input id="@Html.IdFor(model => model.STATUS)"
                               name="@Html.NameFor(model => model.STATUS)"
                               value="@Html.ValueFor(model => model.STATUS)"
                               tabindex="9" required
                               class="easyui-combobox"
                               style="width:100%"
                               type="text"
                               data-options="prompt:'@Html.DisplayNameFor(model => model.STATUS)',
								                   data:qcstatusfiltersource,
                                 " />
                      </div>
                    </div>
                  </form>
                </div>
              </div>
              <div class="widget-body-toolbar">
                <div class="row">
                  <div class="col-sm-8  ">
                    <!-- 开启授权控制请参考 @@if (Html.IsAuthorize("Create") -->
                    <div class="btn-group btn-group-sm">
                      <button onclick="search()" class="btn btn-default"> <i class="fa fa-refresh"></i> 查询 </button>
                    </div>
                    <div class="btn-group btn-group-sm">
                      <button onclick="check105()" class="btn btn-default btn-success"> <i class="fa fa-check-square-o"></i> 检验合格 </button>
                    </div>
                    <div class="btn-group btn-group-sm">
                      <button onclick="check104()" class="btn btn-default btn-danger"> <i class="fa fa-flag-checkered"></i> 检验不合格 </button>
                    </div>



                    <div class="btn-group btn-group-sm hidden-xs hidden-md">
                      <button onclick="exportexcel()" class="btn btn-default"> <i class="fa fa-file-excel-o"></i> @Html.L("Export") </button>
                    </div>

                  </div>
                  <div class="col-sm-4 text-align-right visible-lg-inline-block">
                    <div class="btn-group btn-group-sm">
                      <button onclick="window.history.back()" class="btn btn-sm btn-success"> <i class="fa fa-chevron-left"></i> @Html.L("GoBack") </button>
                    </div>
                  </div>
                </div>

              </div>
              <div class="alert alert-warning no-margin fade in">
                <button class="close" data-dismiss="alert">
                  ×
                </button>
                <i class="fa-fw fa fa-info"></i>
                注意事项:不允许重复检验!
              </div>
              <!--begin datagrid-content -->
              <div class="table-responsive">
                <table id="stocks_datagrid" style="height:400px"></table>
              </div>
              <!--end datagrid-content -->
            </div>
            <!-- end widget content -->
          </div>
          <!-- end widget div -->
        </div>
        <!-- end widget -->
      </article>
      <!-- WIDGET END -->
    </div>
    <!-- end row -->
  </section>
  <!-- end widget grid -->
  <!-- file upload partial view -->


</div>
<!-- END MAIN CONTENT -->

@section Scripts {
  <script type="text/javascript">
      //是否启用弹窗口模式新增编辑数据
      const POPUPMODE = true;
      //是否强制从后台取值
      const REQUIRBACKEND = false;
      //是否开启行内编辑
      const EDITINLINE = false;
      //上传导入参数设定
      const entityname = "STOCK";
    var stock = {};
    //设置默认值
    $(() => {
      $('#STATUS').combobox('setValue', '103');
      $('#RECEIPTDATE2').datebox('setValue', moment().format('YYYY-MM-DD HH:mm:ss'));
      $('#RECEIPTDATE1').datebox('setValue', moment().format('YYYY-MM-DD HH:mm:ss'))
    });
    //不合格
    function check104() {
      const url = '/STOCKs/ChangeSate';
      var rows = $dg.datagrid('getChecked');
      var data = rows.filter(item => { return item.STATUS == '103' }).map(item => { return { ID: item.ID, PQCQTYINSPECTED: item.PQCQTYINSPECTED, STATUS: item.STATUS,SETSTATUS:'104' }; });
      if (data.length > 0) {
        console.log(data);
        $.post(url, { data: data, state: '104' }).done(res => {
          if (res.success) {
            reload();
          } else {
            $.messager.alert('提示', res.err, 'error');
          }
        });
      } else {
        $.messager.alert('提示', '选择先勾选状态为<span class="badge bg-color-red">[待检验]</span>的记录', 'info')
      }

    }
    //合格
    function check105() {
      const url = '/STOCKs/ChangeSate';
      var rows = $dg.datagrid('getChecked');
      var data = rows.filter(item => { return item.STATUS == '103' }).map(item => { return { ID: item.ID, PQCQTYINSPECTED: item.PQCQTYINSPECTED, STATUS: item.STATUS, SETSTATUS: '105' }; });
      if (data.length > 0) {
        console.log(data);
        $.post(url, { data: data, state: '105' }).done(res => {
          if (res.success) {
            reload();
          } else {
            $.messager.alert('提示', res.err, 'error');
          }
        });
      } else {
        $.messager.alert('提示', '选择先勾选状态为<span class="badge bg-color-red">[待检验]</span>的记录', 'info')
      }

    }


	   //执行导出下载Excel
	   function exportexcel() {
				const filterRules = JSON.stringify($dg.datagrid('options').filterRules);
				//console.log(filterRules);
				$.messager.progress({ title: '正在执行导出!' });
				let formData = new FormData();
				formData.append('filterRules', filterRules);
				formData.append('sort', 'ID');
				formData.append('order', 'asc');
				$.postDownload('/STOCKs/ExportExcel', formData).then(res => {
                    $.messager.progress('close');
                    toastr.success('导出成功!');
                }).catch(err => {
                    //console.log(err);
                    $.messager.progress('close');
                    $.messager.alert('失败', err.statusText, 'error');
                });

		}

       var editIndex = undefined;
       //重新加载数据
	   function reload() {

       search();
        $dg.datagrid('uncheckAll');
        $dg.datagrid('unselectAll');

	   }

	function reject() {
	    $dg.datagrid('rejectChanges');
	    editIndex = undefined;
        hook = false;
	}
    //查询
    function search() {
      const po = $('#POKEY').textbox('getValue');
      const suppilercode = $('#SUPPLIERCODE').combogrid('getValue');
      const extkey = $('#EXTERNRECEIPTKEY').textbox('getValue');
      const sku = $('#SKU').textbox('getValue');
      const status = $('#STATUS').combobox('getValue');
      const dt1 = $('#RECEIPTDATE1').datebox('getValue');
      const dt2 = $('#RECEIPTDATE2').datebox('getValue');
      const url = `/STOCKs/GetQCData?suppilercode=${suppilercode}&po=${po}&extkey=${extkey}&sku=${sku}&dt1=${dt1}&dt2=${dt2}&status=${status}`;
      $dg.datagrid('loading');
      $.get(url).done(res => {
        console.log(res);
        $dg.datagrid('loadData', res);
        $dg.datagrid('loaded');
      })

    }

    //修改QC数量
    function onqtychange(index, id, v) {
      var qcqty = parseFloat(v);
      var input = $(`tr[datagrid-row-index='${index}']`).find("input[name='PQCQTYINSPECTED']");
      var qty = $(input[0]).val();
      if (parseFloat(qty) > qcqty) {
        $.messager.alert('提示', `本次QC数量不能超过在库数量[${qcqty}]`, 'info');
        $(input[0]).val(qcqty);
        return;
      }
      $dg.datagrid('updateRow', {
        index: index,
        row: {
          PQCQTYINSPECTED: parseFloat(qty),

        }
      });
    }
    //初始化定义datagrid
    var $dg = $('#stocks_datagrid');
    $(() => {
      //定义datagrid结构
      $dg.datagrid({
        rownumbers: true,
        checkOnSelect: false,
        selectOnCheck: false,
        idField: 'ID',
        sortName: 'ID',
        sortOrder: 'desc',
        remoteFilter: false,
        singleSelect: true,
        pagination: false,
        striped: true,
        onBeforeLoad: function () {
          //datagrid resize when jarvisWidgets resized.
          const that = $(this);
          $(window).on("resize.jarvisWidgets", () => {
            that.datagrid('resize');
          })
        },
        frozenColumns: [[
          /*开启CheckBox选择功能*/
          { field: 'ck', checkbox: true },

        ]],
        columns: [[
          { /*ID*/
            field: 'ID',
            title: '<span class="required">@Html.DisplayNameFor(model => model.ID)</span>',
            width: 120,
            sortable: true,
            resizable: true,
            hidden: true
          },
          {    /*仓库号*/
            field: 'WHSEID',
            title: '<span class="required">@Html.DisplayNameFor(model => model.WHSEID)</span>',
            width: 90,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.WHSEID)', required: true, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*入库批号*/
            field: 'LOT',
            title: '@Html.DisplayNameFor(model => model.LOT)',
            width: 90,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOT)', required: false, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*订单编号*/
            field: 'POKEY',
            title: '@Html.DisplayNameFor(model => model.POKEY)',
            width: 130,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.POKEY)', required: false, validType: 'length[0,30]' }
            },
            sortable: true,
            resizable: true
          },

          {    /*状态*/
            field: 'STATUS',
            title: '<span class="required">@Html.DisplayNameFor(model => model.STATUS)</span>',
            width: 100,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.STATUS)', required: true, validType: 'length[0,10]' }
            },
            sortable: true,
            resizable: true,
            styler: function (v, r, i) {
              if (v == '104') {
                return 'background-color:#FF5722;color:#fff;';
              } else if (v == '105') {
                return 'background-color:#8BC34A;color:#fff;';
              }
            },
            formatter: qcstatusformatter
          },
          {    /*物料编号*/
            field: 'SKU',
            title: '<span class="required">@Html.DisplayNameFor(model => model.SKU)</span>',
            width: 110,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.SKU)', required: true, validType: 'length[0,30]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*物料名称*/
            field: 'SKUNAME',
            title: '@Html.DisplayNameFor(model => model.SKUNAME)',
            width: 220,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.SKUNAME)', required: false, validType: 'length[0,80]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*数量*/
            field: 'QTY',
            title: '<span class="required">@Html.DisplayNameFor(model => model.QTY)</span>',
            width: 100,
            align: 'right',
            hidden: false,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.QTY)',
                required: true,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*QC数量*/
            field: 'PQCQTYINSPECTED',
            title: '<span class="required">@Html.DisplayNameFor(model => model.PQCQTYINSPECTED)</span>',
            width: 100,
            align: 'right',
            hidden: false,
            formatter: function (v, r, i) {
              if (r.STATUS == '103') {
                return `<input type="number" name="PQCQTYINSPECTED" onchange="onqtychange(${i},'${r.ID}','${v}')"  value="${v}" style="width:80px" >`
              } else {
                return `<input type="number" disabled name="PQCQTYINSPECTED" onchange="onqtychange(${i},'${r.ID}')"  value="${v}" style="width:80px" >`
              }

            },
            sortable: true,
            resizable: true
          },
          {    /*供应商代码*/
            field: 'SUPPLIERCODE',
            title: '@Html.DisplayNameFor(model => model.SUPPLIERCODE)',
            width: 110,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.SUPPLIERCODE)', required: false, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*供应商名称*/
            field: 'SUPPLIERNAME',
            title: '@Html.DisplayNameFor(model => model.SUPPLIERNAME)',
            width: 260,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.SUPPLIERNAME)', required: false, validType: 'length[0,80]' }
            },
            sortable: true,
            resizable: true
          },
           {   /*收货单日期*/
            field: 'RECEIPTDATE',
            title: '<span class="required">@Html.DisplayNameFor(model => model.RECEIPTDATE)</span>',
            width: 120,
            align: 'right',
            hidden: false,
            editor: {
              type: 'datebox',
              options: { prompt: '@Html.DisplayNameFor(model => model.RECEIPTDATE)', required: true }
            },
            formatter: dateformatter,
            sortable: true,
            resizable: true
          },

          {    /*单位*/
            field: 'UMO',
            title: '<span class="required">@Html.DisplayNameFor(model => model.UMO)</span>',
            width: 130,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.UMO)', required: true, validType: 'length[0,10]' }
            },
            sortable: true,
            resizable: true
          },
          {   /*入库时间*/
            field: 'INPUTDATETIME',
            title: '<span class="required">@Html.DisplayNameFor(model => model.INPUTDATETIME)</span>',
            width: 160,
            align: 'right',
            hidden: false,
            editor: {
              type: 'datetimebox',
              options: { prompt: '@Html.DisplayNameFor(model => model.INPUTDATETIME)', required: true }
            },
            formatter: datetimeformatter,
            sortable: true,
            resizable: true
          },
          {    /*订单批次号*/
            field: 'EXTERNRECEIPTKEY',
            title: '@Html.DisplayNameFor(model => model.EXTERNRECEIPTKEY)',
            width: 130,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.EXTERNRECEIPTKEY)', required: false, validType: 'length[0,30]' }
            },
            sortable: true,
            resizable: true
          },

          {    /*货主*/
            field: 'STORERKEY',
            title: '<span class="required">@Html.DisplayNameFor(model => model.STORERKEY)</span>',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.STORERKEY)', required: true, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },

          {    /*库位(良品区/不良品区)*/
            field: 'LOC',
            title: '@Html.DisplayNameFor(model => model.LOC)',
            width: 130,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOC)', required: false, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*LPN*/
            field: 'LPN',
            title: '@Html.DisplayNameFor(model => model.LPN)',
            width: 130,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LPN)', required: false, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*外箱标签*/
            field: 'LOTTABLE3',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE3)',
            width: 260,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE3)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },

          {    /*件数*/
            field: 'CASECNT',
            title: '<span class="required">@Html.DisplayNameFor(model => model.CASECNT)</span>',
            width: 100,
            align: 'right',
            hidden: false,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.CASECNT)',
                required: true,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*栈板数*/
            field: 'PALLET',
            title: '<span class="required">@Html.DisplayNameFor(model => model.PALLET)</span>',
            width: 100,
            align: 'right',
            hidden: true,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.PALLET)',
                required: true,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*包装*/
            field: 'PACKKEY',
            title: '@Html.DisplayNameFor(model => model.PACKKEY)',
            width: 130,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.PACKKEY)', required: false, validType: 'length[0,10]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*毛重(KG)*/
            field: 'GROSSWGT',
            title: '<span class="required">@Html.DisplayNameFor(model => model.GROSSWGT)</span>',
            width: 100,
            align: 'right',
            hidden: true,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.GROSSWGT)',
                required: true,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*净重(KG)*/
            field: 'NETWGT',
            title: '<span class="required">@Html.DisplayNameFor(model => model.NETWGT)</span>',
            width: 100,
            align: 'right',
            hidden: true,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.NETWGT)',
                required: true,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*体积(M)*/
            field: 'CUBE',
            title: '<span class="required">@Html.DisplayNameFor(model => model.CUBE)</span>',
            width: 100,
            align: 'right',
            hidden: true,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.CUBE)',
                required: true,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*收货单号*/
            field: 'RECEIPTKEY',
            title: '<span class="required">@Html.DisplayNameFor(model => model.RECEIPTKEY)</span>',
            width: 130,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.RECEIPTKEY)', required: true, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*供应商物料编号*/
            field: 'ALTSKU',
            title: '@Html.DisplayNameFor(model => model.ALTSKU)',
            width: 130,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.ALTSKU)', required: false, validType: 'length[0,30]' }
            },
            sortable: true,
            resizable: true
          },

          {    /*出库批次号*/
            field: 'EXTERNORDERKEY',
            title: '@Html.DisplayNameFor(model => model.EXTERNORDERKEY)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.EXTERNORDERKEY)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*拣货单号*/
            field: 'PICKDETAILKEY',
            title: '@Html.DisplayNameFor(model => model.PICKDETAILKEY)',
            width: 130,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.PICKDETAILKEY)', required: false, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*出货单号*/
            field: 'ORDERKEY',
            title: '@Html.DisplayNameFor(model => model.ORDERKEY)',
            width: 130,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.ORDERKEY)', required: false, validType: 'length[0,20]' }
            },
            sortable: true,
            resizable: true
          },
          {   /*出库时间*/
            field: 'OUTPUTDATETIME',
            title: '@Html.DisplayNameFor(model => model.OUTPUTDATETIME)',
            width: 160,
            align: 'right',
            hidden: true,
            editor: {
              type: 'datetimebox',
              options: { prompt: '@Html.DisplayNameFor(model => model.OUTPUTDATETIME)', required: false }
            },
            formatter: datetimeformatter,
            sortable: true,
            resizable: true
          },
          {    /*备注*/
            field: 'NOTES',
            title: '@Html.DisplayNameFor(model => model.NOTES)',
            width: 260,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.NOTES)', required: false, validType: 'length[0,100]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*工厂名称*/
            field: 'LOTTABLE1',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE1)',
            width: 260,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE1)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*公司名称*/
            field: 'LOTTABLE2',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE2)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE2)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*发货单号*/
            field: 'LOTTABLE4',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE4)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE4)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*入库类型*/
            field: 'LOTTABLE5',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE5)',
            width: 260,
            hidden: false,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE5)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*LOTTABLE6*/
            field: 'LOTTABLE6',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE6)',
            width: 100,
            align: 'right',
            hidden: true,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.LOTTABLE6)',
                required: false,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {    /*LOTTABLE7*/
            field: 'LOTTABLE7',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE7)',
            width: 100,
            align: 'right',
            hidden: true,
            editor: {
              type: 'numberbox',
              options: {
                prompt: '@Html.DisplayNameFor(model => model.LOTTABLE7)',
                required: false,
                precision: 2,
                validType: 'decimal',

              }
            },
            formatter: numberformatter,
            sortable: true,
            resizable: true
          },
          {   /*LOTTABLE7*/
            field: 'LOTTABLE8',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE8)',
            width: 120,
            align: 'right',
            hidden: true,
            editor: {
              type: 'datebox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE8)', required: false }
            },
            formatter: dateformatter,
            sortable: true,
            resizable: true
          },
          {    /*LOTTABLE9*/
            field: 'LOTTABLE9',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE9)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE9)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*LOTTABLE10*/
            field: 'LOTTABLE10',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE10)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE10)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*LOTTABLE11*/
            field: 'LOTTABLE11',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE11)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE11)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
          {    /*LOTTABLE12*/
            field: 'LOTTABLE12',
            title: '@Html.DisplayNameFor(model => model.LOTTABLE12)',
            width: 260,
            hidden: true,
            editor: {
              type: 'textbox',
              options: { prompt: '@Html.DisplayNameFor(model => model.LOTTABLE12)', required: false, validType: 'length[0,50]' }
            },
            sortable: true,
            resizable: true
          },
        ]]
      });

      $dg.datagrid('enableFilter', [
        {   /*ID*/
          field: 'ID',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*状态*/
          field: 'STATUS',
          type: 'qcstatusfilter'
        },
        {   /*状态*/
          field: 'SUPPLIERCODE',
          type: 'supplierfilter'
        },
        {   /*数量*/
          field: 'QTY',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*件数*/
          field: 'CASECNT',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*栈板数*/
          field: 'PALLET',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*毛重(KG)*/
          field: 'GROSSWGT',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*净重(KG)*/
          field: 'NETWGT',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*体积(M)*/
          field: 'CUBE',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*LOTTABLE6*/
          field: 'LOTTABLE6',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {   /*LOTTABLE7*/
          field: 'LOTTABLE7',
          type: 'numberbox',
          op: ['equal', 'notequal', 'less', 'lessorequal', 'greater', 'greaterorequal']
        },
        {     /*收货单日期*/
          field: 'RECEIPTDATE',
          type: 'dateRange',
          options: {
            onChange: value => {
              $dg.datagrid('addFilterRule', {
                field: 'RECEIPTDATE',
                op: 'between',
                value: value
              });

              $dg.datagrid('doFilter');
            }
          }
        },
        {     /*入库时间*/
          field: 'INPUTDATETIME',
          type: 'dateRange',
          options: {
            onChange: value => {
              $dg.datagrid('addFilterRule', {
                field: 'INPUTDATETIME',
                op: 'between',
                value: value
              });

              $dg.datagrid('doFilter');
            }
          }
        },
        {     /*出库时间*/
          field: 'OUTPUTDATETIME',
          type: 'dateRange',
          options: {
            onChange: value => {
              $dg.datagrid('addFilterRule', {
                field: 'OUTPUTDATETIME',
                op: 'between',
                value: value
              });

              $dg.datagrid('doFilter');
            }
          }
        },
        {     /*LOTTABLE7*/
          field: 'LOTTABLE8',
          type: 'dateRange',
          options: {
            onChange: value => {
              $dg.datagrid('addFilterRule', {
                field: 'LOTTABLE8',
                op: 'between',
                value: value
              });

              $dg.datagrid('doFilter');
            }
          }
        },
      ]);
    });

  </script>



}


